PROJECT=vm1

OPTIMIZATION=-o3 -march=native -msse -msse2 -msse3 -msse4a -m3dnow -mmmx

DIRS_INCLUDE=-Iinclude

DIRS_LIB_STATIC=-Llib/static
DIRS_LIB_DYNAMIC=-Iinclude -Llib/dynamic

DIRS_LIB=$(DIRS_LIB_DYNAMIC) $(DIRS_LIB_STATIC)

LIBS_BOOST_STATIC=#-lboost_thread
LIBS_BOOST_DYNAMIC=#-lboost_thread.so
LIBS_MISC=-lpthread
MISC_OPTIONS=

WARNING_OPTIONS=-Wall

DEBUG_OPTIONS=  -g $(DIRS_INCLUDE)                  $(WARNING_OPTIONS)  $(MISC_OPTIONS)
#RELEASE_OPTIONS= -g  $(DIRS_INCLUDE)  $(WARNING_OPTIONS)  $(MISC_OPTIONS)
RELEASE_OPTIONS= -g  $(DIRS_INCLUDE) $(OPTIMIZATION)  $(WARNING_OPTIONS)  $(MISC_OPTIONS)
############################################################################
All: vm2
############################################################################
obj/Release/main.o: src/main.cpp src/definitions.hpp
	g++  -c  $(RELEASE_OPTIONS)   src/main.cpp                 -o obj/Release/main.o

Release:  obj/Release/main.o 
	g++      $(RELEASE_OPTIONS)  $(DIRS_LIB)     obj/Release/*.o                      -o  bin/Release/$(PROJECT) $(LIBS_BOOST_STATIC)
############################################################################
obj/vm2/main_vm2.o: src/main_vm2.cpp src/inter.hpp src/definitions.hpp
	g++  -c  $(RELEASE_OPTIONS)   src/main_vm2.cpp                 -o obj/vm2/main_vm2.o

vm2:  obj/vm2/main_vm2.o
	g++      $(RELEASE_OPTIONS)  $(DIRS_LIB)     obj/vm2/*.o                      -o  bin/vm2/vm2 $(LIBS_BOOST_STATIC)

###########################################################################
obj/Test/config.o: src/config.cpp src/config.hpp src/definitions.hpp
	g++  -c  $(DEBUG_OPTIONS)  $(DIRS_INCLUDE) src/config.cpp                    -o obj/Test/config.o

#$(OPTIMIZATION)

obj/Test/vector.o: src/vector.cpp src/vector.hpp src/definitions.hpp
	g++  -c  $(DEBUG_OPTIONS)   $(DIRS_INCLUDE) src/vector.cpp    -o obj/Test/vector.o

obj/Test/scene.o: src/scene.cpp src/scene.hpp src/definitions.hpp
	g++  -c  $(DEBUG_OPTIONS)  $(DIRS_INCLUDE) src/scene.cpp                     -o obj/Test/scene.o

obj/Test/color.o: src/color.cpp src/color.hpp src/definitions.hpp
	g++  -c  $(DEBUG_OPTIONS)  $(DIRS_INCLUDE) src/color.cpp                     -o obj/Test/color.o


obj/Test/primitive.o: src/primitive.cpp src/primitive.hpp src/definitions.hpp
	g++  -c  $(DEBUG_OPTIONS)  $(DIRS_INCLUDE) src/primitive.cpp                 -o obj/Test/primitive.o

obj/Test/camera.o: src/Camera.cpp src/Camera.hpp src/definitions.hpp
	g++  -c  $(DEBUG_OPTIONS)  $(DIRS_INCLUDE) src/Camera.cpp                    -o obj/Test/camera.o

obj/Test/ThreadFuncWork.o: src/ThreadFuncWork.cpp src/ThreadFuncWork.hpp src/definitions.hpp
	g++  -c  $(DEBUG_OPTIONS)  $(DIRS_INCLUDE) src/ThreadFuncWork.cpp            -o obj/Test/ThreadFuncWork.o

obj/Test/main_test.o: src/main_test.cpp src/definitions.hpp
	g++  -c  $(DEBUG_OPTIONS)  $(DIRS_INCLUDE) src/main_test.cpp                 -o obj/Test/main_test.o


Test: obj/Test/vector.o obj/Test/camera.o obj/Test/primitive.o obj/Test/scene.o  obj/Test/main_test.o obj/Test/config.o obj/Test/ThreadFuncWork.o obj/Test/color.o
	g++      $(DEBUG_OPTIONS)  $(DIRS_LIB)     obj/Test/*.o                      -o  bin/Test/$(PROJECT) -lIL  $(LIBS_BOOST_STATIC) $(LIBS_MISC)
#	rm -f bin/Test/lol
#	time bin/Test/rays>log
############################################################################
Clean:
	rm -rf bin/*
	rm -rf obj/*
############################################################################
Init: Clean
	mkdir -p bin/Debug
	mkdir -p bin/Release
	mkdir -p obj/Debug
	mkdir -p obj/Release
	mkdir -p obj/Test
	mkdir -p bin/Test
	mkdir -p bin/vm2
	mkdir -p obj/vm2
	link simple_matrix.txt bin/Release/matrix.txt
	link simple_data.txt bin/vm2/data.txt
#	link config.json bin/Release/config.json
#	link config.json bin/Debug/config.json
############################################################################

